object Bag32Help: TBag32Help Left = 378 Top = 181 Width = 640 Height = 480 Caption = 'TBag32 Help' Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] Scaled = False ShowHint = True OnClose = FormClose OnShow = FormShow PixelsPerInch = 96 TextHeight = 13 object Panel1: TPanel Left = 0 Top = 0 Width = 142 Height = 453 Align = alLeft BevelOuter = bvNone Caption = ' ' TabOrder = 0 object lbTopics: TListBox Left = 0 Top = 145 Width = 142 Height = 308 Align = alClient Font.Color = clNavy Font.Height = -13 Font.Name = 'Arial' Font.Style = [fsBold] ItemHeight = 16 ParentFont = False TabOrder = 0 OnClick = lbTopicsClick end object Panel2: TPanel Left = 0 Top = 0 Width = 142 Height = 145 Align = alTop BevelOuter = bvNone Caption = ' ' TabOrder = 1 object rgTopics: TRadioGroup Left = 12 Top = 8 Width = 117 Height = 129 Caption = 'Topics' Font.Color = clRed Font.Height = -13 Font.Name = 'Arial' Font.Style = [fsBold] Items.Strings = ( 'About' 'Usage' 'Properties' 'Methods' 'Events' 'Build History') ParentFont = False TabOrder = 0 OnClick = rgTopicsClick end end end object memTopics: TRichEdit Left = 142 Top = 0 Width = 490 Height = 453 Align = alClient HideScrollBars = False ReadOnly = True ScrollBars = ssVertical TabOrder = 1 end object ListBox1: TListBox Left = 216 Top = 56 Width = 121 Height = 97 ItemHeight = 13 Items.Strings = ( '{\rtf1\ansi\ansicpg1252\deff0\deftab720{\fonttbl{\f0\fswiss MS S' + 'ans Serif;}{\f1\froman\fcharset2 Symbol;}{\f2\fswiss MS Sans Ser' + 'if;}{\f3\fswiss Arial;}{\f4\fmodern Courier New;}{\f5\fswiss\fpr' + 'q2 System;}}' '{\colortbl\red0\green0\blue0;\red255\green0\blue0;\red0\green0\b' + 'lue128;\red0\green0\blue255;\red0\green128\blue128;\red0\green12' + '8\blue0;}' '\deflang1033\horzdoc{\*\fchars }{\*\lchars }\pard\li480\ri840\pl' + 'ain\f2\fs12\cf0 ' '\par \pard\li480\ri840\qc\plain\f3\fs32\cf1\b ===ABOUT===\plain\' + 'f4\fs20 ' '\par \pard\li480\ri840\plain\f4\fs20 ' '\par \plain\f3\fs24\cf2\b ---ABOUT: TBag32 Version\plain\f4\fs20' + ' ' '\par ' '\par \plain\f2\fs24\b Build = 003\plain\f2\fs20\b (06-Mar-97)' '\par ' '\par \plain\f4\fs20 ' '\par ' '\par \plain\f3\fs24\cf2\b ---ABOUT: TBag32 Author\plain\f4\fs20 ' '\par ' '\par \plain\f3\fs24\cf3\b Mike Orriss\plain\f3\fs20\cf3\b (3K ' + 'Computer Consultancy)\plain\f3\fs20\b ' '\par ' '\par \plain\f3\fs20\cf3\b e-mail: mjo@compuserve.com' '\par tel: +44 (0)1785 824053' '\par ' '\par ' '\par \plain\f4\fs20 ' '\par ' '\par \plain\f3\fs24\cf2\b ---ABOUT: TBag32 Source Code\plain\f4\' + 'fs20 ' '\par ' '\par \plain\f2\fs20 TBag32 compiled code is free via Compuserve ' + 'BDelphi forum library 22 (\plain\f2\fs20\cf3 TBAG32.ZIP\plain\f2' + '\fs20 ).' '\par ' '\par The full source code is available from Compuserve SWREG for' + ' U.S $20.' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par \plain\f4\fs20 ' '\par \pard\li480\ri840\qc\plain\f3\fs32\cf1\b ===USAGE===\plain\' + 'f4\fs20 ' '\par \pard\li480\ri840\plain\f4\fs20 ' '\par \plain\f3\fs24\cf2\b ---USAGE: Purpose\plain\f4\fs20 ' '\par ' '\par \plain\f2\fs20 TBag32 is designed to simplify saving/restor' + 'ing user settings via the Win32 Registry.' '\par ' '\par This is achieved via pairs of methods, e.g GetString & SetS' + 'tring. All '#39'Set'#39' methods are procedures but the '#39'Get'#39' methods ar' + 'e a mixture of functions and procedures, depending whether the w' + 'hole object is changing or just one of its properties.' '\par ' '\par For example, compare GetFont and GetFontAndColor:' '\par \plain\f4\fs20 ' '\par \plain\f4\fs20\cf3 SubKey := '#39'SOFTWARE\\3K\\TEST\\'#39';' '\par Memo1.Font := GetFont('#39'FONT'#39',Memo1.Font);' '\par GetFontAndColor('#39'F_AND_C'#39',Memo1);\plain\f4\fs20 ' '\par ' '\par \plain\f2\fs20 In the first case, the 2nd parameter is the ' + 'default value and you could use any Font property - it doesn'#39't ' + 'have to be Memo1.' '\par ' '\par In the second case, Memo1'#39's Font & Color properties will be' + ' updated if the registry entry exists.' '\par ' '\par ' '\par \plain\f4\fs20 ' '\par \plain\f3\fs24\cf2\b ---USAGE: Typical\plain\f4\fs20 ' '\par ' '\par \plain\f2\fs20 A simple way of using TBag32 is to place the' + ' '#39'Get'#39' methods in Form.Show and the '#39'Set'#39' methods in Form.Close,' + ' e.g assuming that Bag1 is a TBag32 component:' '\par \plain\f4\fs20 ' '\par \plain\f4\fs20\cf3 procedure TForm1.FormShow(Sender: TObje' + 'ct);' '\par begin' '\par with Bag1 do begin' '\par GetFormPlace('#39'FORMPLACE'#39',Self);' '\par Box1.ItemIndex:=GetInteger('#39'LB'#39',0);' '\par end;' '\par end;' '\par ' '\par procedure TForm1.FormClose(Sender: TObject; var Action: TC' + 'loseAction);' '\par begin' '\par with Bag1 do begin' '\par SetInteger('#39'LB'#39',Box1.ItemIndex);' '\par SetFormPlace('#39'FORMPLACE'#39',Self);' '\par end;' '\par end;' '\par ' '\par \plain\f4\fs20 ' '\par ' '\par \plain\f3\fs24\cf2\b ---USAGE: Registry Keys\plain\f4\fs20 ' '\par ' '\par \plain\f2\fs20 TBag32 sets the default Registry root key to' + ':' '\par ' '\par \plain\f2\fs20\cf3 HKEY_CURRENT_USERS\plain\f2\fs20 ' '\par ' '\par and all keys supplied (which may be left blank) to the Get/' + 'Set methods are relative to that. For normal purposes this is su' + 'fficient but you can change the RootKey property if you wish to ' + ' use a different Registry root.' '\par ' '\par The SubKey property allows you to set a common Registry key' + ', simplifying the statements required. The following sets of sta' + 'tements are logically equivalent:' '\par ' '\par \plain\f4\fs20\cf3 SubKey := '#39#39';' '\par SetString('#39'Software\\3K\\TBag32\\Title'#39','#39'default title'#39');' '\par SetBoolean('#39'Software\\3K\\TBag32\\First'#39',True);' '\par ' '\par SubKey := '#39'Software\\3K'#39';' '\par SetString('#39'TBag32\\Title'#39','#39'default title'#39');' '\par SetBoolean('#39'TBag32\\First'#39',True);' '\par ' '\par SubKey := '#39'Software\\3K\\TBag32'#39';' '\par SetString('#39'Title'#39','#39'default title'#39');' '\par SetBoolean('#39'First'#39',True);' '\par ' '\par \plain\f2\fs20 Note: as the GetAll method processes multipl' + 'e keys, it does not use the SubKey property.' '\par ' '\par ' '\par \plain\f4\fs20 ' '\par ' '\par \plain\f3\fs24\cf2\b ---USAGE: GetAll\plain\f4\fs20 ' '\par ' '\par \plain\f2\fs20 The GetAll method is a special case. It allo' + 'ws you to iterate through a section of the Registry and, by usi' + 'ng one or more of the events provided, you can display the regi' + 'stry contents.' '\par The \plain\f2\fs20\cf3 TEST.DPR\plain\f2\fs20 demo provide' + 'd shows how to display via a TreeView using very few lines of co' + 'de.' '\par ' '\par Note that the GetStrings method handles all types of Regist' + 'ry entries. Particularly useful is the display of binary entries' + ', which are displayed in \plain\f2\fs20\b binary and character \' + 'plain\f2\fs20 format.' '\par ' '\par Also note: as the GetAll method processes multiple keys, it' + ' does not use the SubKey property.' '\par ' '\par \plain\f4\fs20 ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par \pard\li480\ri840\qc\plain\f3\fs32\cf1\b ===PROPERTIES===\p' + 'lain\f4\fs20 ' '\par \pard\li480\ri840\plain\f4\fs20 ' '\par \plain\f3\fs24\cf2\b ---PROPERTIES: Name\plain\f4\fs20 ' '\par ' '\par \plain\f2\fs20 Standard property.\plain\f4\fs20 ' '\par ' '\par ' '\par ' '\par \plain\f3\fs24\cf2\b ---PROPERTIES: RootKey\plain\f4\fs20 ' '\par ' '\par \plain\f2\fs20 Controls the section of the Registry being p' + 'rocessed.' '\par ' '\par ' '\par ' '\par \plain\f3\fs24\cf2\b ---PROPERTIES: SubKey\plain\f4\fs20 ' '\par ' '\par \plain\f2\fs20 Allows you to set a common Registry key. The' + ' following pairs of statements are logically equivalent:' '\par ' '\par \plain\f4\fs20\cf3 SubKey := '#39#39';' '\par SetString('#39'Software\\3K\\TBag32\\Title'#39','#39'default title'#39');' '\par ' '\par SubKey := '#39'Software\\3K\\TBag32'#39';' '\par SetString('#39'Title'#39','#39'default title'#39');' '\par \plain\f2\fs20 ' '\par \plain\f4\fs20 ' '\par ' '\par \plain\f3\fs24\cf2\b ---PROPERTIES: Tag\plain\f4\fs20 ' '\par ' '\par \plain\f2\fs20 Standard property. Note that this could be u' + 'sed to differentiate between multiple GetAll calls, so that its ' + 'four events can operate in a different fashion for each call.\pl' + 'ain\f4\fs20 ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par ' '\par \pard\li480\ri840\qc\plain\f3\fs32\cf1\b ===METHODS===' '\par ' '\par \pard\li480\ri840\plain\f2\fs20 All the methods below (with' + ' the exception of GetAll) have a first parameter of AName which ' + 'represents the concatenation of the Registry key, the SubKey pro' + 'perty and the identity. TBag32 extracts the last token as the id' + 'entity, leaving the remainder of AName as the Registry key.' '\par ' '\par For example, you might say:' '\par ' '\par \plain\f4\fs20\cf3 SubKey := '#39'Software\\3K'#39';\plain\f2\fs2' + '0 ' '\par \plain\f4\fs20\cf3 len := GetInteger(TBag\\Index1'#39',0);\pl' + 'ain\f2\fs20 ' '\par ' '\par This will extract the value of Index1 for the '#39'Software\\3K' + '\\TBag'#39' key, returning zero if the key doesn'#39't exist.' '\par ' '\par \plain\f4\fs20 ' '\par ' '\par \plain\f3\fs24\cf2\b ---METHODS: Construct\plain\f4\fs20 ' '\par ' '\par \plain\f4\fs20\cf3 constructor Construct(subkey: string);\p' + 'lain\f4\fs20 ' '\par ' '\par \plain\f2\fs20 This is a convenient way of creating a TBag3' + '2 object at run-time. Application is the owner of the TBag32 in' + 'stance created. ' '\par ' '\par \plain\f4\fs20\cf3 Example:' '\par ' '\par with TBag32.Construct('#39'Software\\3K\\TBag32'#39') do try ' '\par GetStrings('#39'LIST_ITEMS'#39',ListBox1.Items);' '\par finally' '\par Free;' '\par end;\plain\f4\fs20 ' '\par ' '\par ' '\par ' '\par \plain\f4\fs28\cf4 __________________________________\plain' + '\f4\fs28 ' '\par \plain\f3\fs24\cf2\b ' '\par ---METHODS: GetDataSize\plain\f4\fs20 ' '\par ' '\par \plain\f4\fs20\cf3 procedure GetDataSize(const AName: strin' + 'g): integer;\plain\f4\fs20 ' '\par ' '\par \plain\f2\fs20 Returns the size of a data value. If the key' + ' does not exist, it returns -1. Use this function in order to si' + 'ze the buffer you provide for the GetBinary procedure.' '\par ' '\par \plain\f4\fs20\cf3 Example:' '\par ' '\par blen := GetDataSize('#39'Bin'#39');' '\par if blen > 0 then begin' '\par buffer := AllocMem(blen);' '\par try' '\par blen:=GetBinary('#39'Bin'#39',buffer,blen);' '\par // process buffer;' '\par finally' '\par FreeMem(buffer);' '\par end;' '\par end;\plain\f4\fs20 ' '\par ' '\par ' '\par ' '\par \plain\f4\fs28\cf4 __________________________________\plain' + '\f4\fs28 ' '\par \plain\f3\fs24\cf2\b ' '\par ---METHODS: GetAll\plain\f4\fs20 ' '\par ' '\par \plain\f4\fs20\cf3 procedure GetAll(const AKey: string; max' + 'level: integer);\plain\f4\fs20 ' '\par ' '\par \plain\f2\fs20 Iterates through a section of the registry. ' + 'Place your processing in one or more of its associated events.' '\par The '#39'maxlevel'#39' parameter restricts the number of nested lev' + 'els down the Registry tree that are processed and is provided fo' + 'r performance reasons:\plain\f4\fs20 ' '\par ' '\par \plain\f4\fs20\cf3 GetAll('#39#39',99);\plain\f4\fs20 ' '\par ' '\par \plain\f2\fs20 on '#39'\plain\f2\fs20\b HKEY_CURRENT_USER\plain' + '\f2\fs20 '#39' may be a bit slow.' '\par \plain\f4\fs20 ' '\par ' '\par \plain\f4\fs28\cf4 __________________________________\plain' + '\f4\fs28 ' '\par \plain\f4\fs20 ' '\par ' '\par \plain\f3\fs24\cf2\b ---METHODS: GetBinary\plain\f4\fs20 ' '\par ' '\par \plain\f4\fs20\cf3 function GetBinary(const AName: string; ' + 'var Buffer; BufSize: integer): integer;' '\par \plain\f4\fs20 ' '\par ' '\par \plain\f3\fs24\cf2\b ---METHODS: SetBinary\plain\f4\fs20 ' '\par ' '\par \plain\f4\fs20\cf3 procedure SetBinary(const AName: string;' + ' var Buffer; BufSize: integer);\plain\f4\fs20 ' '\par ' '\par \plain\f4\fs28\cf4 __________________________________\plain' + '\f4\fs28 ' '\par \plain\f4\fs20 ' '\par ' '\par \plain\f3\fs24\cf2\b ---METHODS: GetBoolean\plain\f4\fs20 ' '\par ' '\par \plain\f4\fs20\cf3 function GetBoolean(const AName: string;' + ' ADef: Boolean): Boolean;' '\par \plain\f4\fs20 ' '\par ' '\par \plain\f3\fs24\cf2\b ---METHODS: SetBoolean\plain\f4\fs20 ' '\par ' '\par \plain\f4\fs20\cf3 procedure SetBoolean(const AName: string' + '; AValue: Boolean);\plain\f4\fs20 ' '\par ' '\par \plain\f4\fs28\cf4 __________________________________\plain' + '\f4\fs28 ' '\par \plain\f4\fs20 ' '\par ' '\par \plain\f3\fs24\cf2\b ---METHODS: GetColor\plain\f4\fs20 ' '\par ' '\par \plain\f4\fs20\cf3 function GetColor(const AName: string; c' + 'onst ADef: TColor): ' '\par TColor;' '\par \plain\f4\fs20 ' '\par ' '\par \plain\f3\fs24\cf2\b ---METHODS: SetColor\plain\f4\fs20 ' '\par ' '\par \plain\f4\fs20\cf3 procedure SetColor(const AName: string; ' + 'const AValue: TColor);\plain\f4\fs20 ' '\par ' '\par \plain\f4\fs28\cf4 __________________________________\plain' + '\f4\fs28 ' '\par \plain\f4\fs20 ' '\par ' '\par \plain\f3\fs24\cf2\b ---METHODS: GetFormPlace\plain\f4\fs20' + ' ' '\par ' '\par \plain\f4\fs20\cf3 procedure GetFormPlace(const AName: stri' + 'ng; const AForm: TForm);' '\par ' '\par \plain\f2\fs20\cf0 Restores the form to the saved position,' + ' size and state.' '\par ' '\par \plain\f4\fs20\cf3 Example: ' '\par ' '\par procedure TForm1.FormShow(Sender: TObject);' '\par begin' '\par with Bag1 do begin' '\par GetFormPlace('#39'FORMPLACE'#39',Self);' '\par end;' '\par end;' '\par \plain\f4\fs20 ' '\par ' '\par \plain\f3\fs24\cf2\b ---METHODS: SetFormPlace\plain\f4\fs20' + ' ' '\par ' '\par \plain\f4\fs20\cf3 procedure SetFormPlace(const AName: stri' + 'ng; const AForm: TForm);\plain\f4\fs20 ' '\par \plain\f2\fs20\cf0 ' '\par Saves the form'#39's position, size and state.' '\par ' '\par \plain\f4\fs20\cf3 Example: ' '\par ' '\par procedure TForm1.FormCloseQuery(Sender: TObject; var CanClo' + 'se: Boolean);' '\par begin' '\par with Bag1 do begin' '\par SetFormPlace('#39'FORMPLACE'#39',Self);' '\par end;' '\par end;\plain\f4\fs20 ' '\par ' '\par \plain\f4\fs28\cf4 __________________________________\plain' + '\f4\fs28 ' '\par \plain\f4\fs20 ' '\par ' '\par \plain\f3\fs24\cf2\b ---METHODS: GetFont\plain\f4\fs20 ' '\par ' '\par \plain\f4\fs20\cf3 function GetFont(const AName: string; AD' + 'ef: TFont): TFont;\plain\f4\fs20 ' '\par ' '\par ' '\par ' '\par \plain\f3\fs24\cf2\b ---METHODS: SetFont\plain\f4\fs20 ' '\par ' '\par \plain\f4\fs20\cf3 procedure SetFont(const AName: string; c' + 'onst AValue: TFont);\plain\f4\fs20 ' '\par ' '\par \plain\f4\fs28\cf4 __________________________________\plain' + '\f4\fs28 ' '\par \plain\f4\fs20 ' '\par ' '\par \plain\f3\fs24\cf2\b ---METHODS: GetFontAndColor\plain\f4\f' + 's20 ' '\par ' '\par \plain\f4\fs20\cf3 procedure GetFontAndColor(const AName: s' + 'tring; const AComp: TWinControl);\plain\f4\fs20 ' '\par ' '\par \plain\f2\fs20 Many window controls have Font and Color pro' + 'perties and this method is useful for restoring/saving as a sing' + 'le operation. Note that the control must be descended from TCont' + 'rol for this method to work.' '\par ' '\par The Font & Color properties are left unchanged if the Regis' + 'try entry does not exist.\plain\f4\fs20 ' '\par ' '\par ' '\par \plain\f3\fs24\cf2\b ---METHODS: SetFontAndColor\plain\f4\f' + 's20 ' '\par ' '\par \plain\f4\fs20\cf3 procedure SetFontAndColor(const AName: s' + 'tring; const AComp: TWinControl);\plain\f4\fs20 ' '\par ' '\par \plain\f2\fs20 This method saves AComp'#39's Font and Color pro' + 'perties into a single binary registry entry.\plain\f4\fs20 ' '\par ' '\par \plain\f4\fs28\cf4 __________________________________\plain' + '\f4\fs28 ' '\par \plain\f4\fs20 ' '\par ' '\par \plain\f3\fs24\cf2\b ---METHODS: GetInteger\plain\f4\fs20 ' '\par ' '\par \plain\f4\fs20\cf3 function GetInteger(const AName: string;' + ' ADef: integer): integer;\plain\f4\fs20 ' '\par ' '\par ' '\par \plain\f3\fs24\cf2\b ---METHODS: SetInteger\plain\f4\fs20 ' '\par ' '\par \plain\f4\fs20\cf3 procedure SetInteger(const AName: string' + '; AValue: integer);\plain\f4\fs20 ' '\par ' '\par \plain\f4\fs28\cf4 __________________________________\plain' + '\f4\fs28 ' '\par \plain\f4\fs20 ' '\par ' '\par \plain\f3\fs24\cf2\b ---METHODS: GetString\plain\f4\fs20 ' '\par ' '\par \plain\f4\fs20\cf3 function GetString(const AName,ADef: str' + 'ing): string;\plain\f4\fs20 ' '\par ' '\par \plain\f2\fs20 The GetString method will handle any kind of' + ' Registry entry, returning '#39'\plain\f2\fs20\cf3 \pl' + 'ain\f2\fs20 '#39' or '#39'\plain\f2\fs20\cf3 \plain\f2\fs20 '#39' f' + 'or the two datatypes it cannot handle. See GetStrings below in o' + 'rder to display binary data in a TStrings descendant.\plain\f4\f' + 's20 ' '\par ' '\par ' '\par \plain\f3\fs24\cf2\b ---METHODS: SetString\plain\f4\fs20 ' '\par ' '\par \plain\f4\fs20\cf3 procedure SetString(const AName,AValue: ' + 'string);\plain\f4\fs20 ' '\par ' '\par \plain\f4\fs28\cf4 __________________________________\plain' + '\f4\fs28 ' '\par \plain\f4\fs20 ' '\par ' '\par \plain\f3\fs24\cf2\b ---METHODS: GetStrings\plain\f4\fs20 ' '\par ' '\par \plain\f4\fs20\cf3 procedure GetStrings(const AName: string' + '; AValue: TStrings);\plain\f4\fs20 ' '\par ' '\par \plain\f2\fs20 This method handles all datatypes in a usefu' + 'l manner except for '#39'